// $_FILEHEADER_BEGIN ***************************
// 版权声明:Timer
// Copyright © 2012 - Timer All Rights Reserved
// 文件名称: ZXTestView.m
// 创建日期: 15/12/1
// 创 建 人: 甄鑫
// 文件说明: <#content#>
// $_FILEHEADER_END ******************************


#import "ZXTestView.h"
#import "NavStatus.h"
#import "NavHelper.h"
#import "LoginViewModel.h"
#import "LoginRequest.h"
#import "BarrageView.h"

@implementation ZXTestView

- (IBAction)click1:(id)sender
{
    [[NavStatus sharedInstance]getCurVC];
}
- (IBAction)click2:(id)sender {
    [[NavStatus sharedInstance]getCurTabbarType];
}
- (IBAction)click3:(id)sender
{
    [NavHelper gotoLoginVC];
}
- (IBAction)click4:(id)sender {
    LoginRequest *request = [LoginRequest Request];
    request.key = @"123";
    [[RACObserve(request, state) filter:^BOOL(NSNumber *state) {
          return request.succeed;
        }]
     subscribeNext:^(id x){
        NSLog(@"--%@",request.output);
    }];
//    request.requestNeedActive = YES;
    
    LoginViewModel * testSceneModel = [LoginViewModel SceneModel];
    [testSceneModel SEND_ACTION:request];
    
}
static BarrageView * _barrageView;
- (IBAction)click5:(id)sender {
    if (!_barrageView) {
        _barrageView = [[BarrageView alloc]initWithFrame:CGRectMake(0, 100, SCREEN_WIDTH, 200)];
        [self addSubview:_barrageView];
    }
    NSMutableArray *barrageArr = [[NSMutableArray alloc]init];
    for (NSInteger index = 0; index < 20; index ++) {
        BarrageItemModel * itemModel = [[BarrageItemModel alloc]init];
        itemModel.uid = @"aasdfas";
        [itemModel setContentStr:@"asdfasdfasdfasdfasdf"];
        [itemModel setPlayTime:(arc4random() % 4 + 4)];
        [itemModel setIsShowRedSpecial:arc4random()%2];
        [itemModel setRedSpecialContent:@"asdfasdfasd"];
        [barrageArr addObject:itemModel];
    }
    [_barrageView setPlayTime:30];
    [_barrageView setBrrageDataArr:barrageArr];
    [_barrageView playAnimation];
}

@end
